package jp.seraph.robocup.soccer.sample.agent;

import java.io.BufferedWriter;
import java.io.FileWriter;

import jp.seraph.jsade.core.DefaultAgentRunner;
import jp.seraph.jsade.core.DefaultWorld;
import jp.seraph.jsade.core.NopSeeObjectCalculator;
import jp.seraph.jsade.model.nao.NaoModelManager;

public class SampleAgentRunner {

    /**
     * @param args
     */
    public static void main(String[] args) {
        BufferedWriter tWriter = null;

        try {
            tWriter = new BufferedWriter(new FileWriter("JointData.txt"));
            DefaultAgentRunner tRunner = new DefaultAgentRunner(new DefaultWorld(new NaoModelManager(0), new NopSeeObjectCalculator()), new SampleAgentContext(), new SampleAgent(tWriter));

            tRunner.start();

            try {
                tRunner.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (tWriter != null){
                    tWriter.flush();
                    tWriter.close();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            
            System.out.println("end");
        }
    }
}
